package online.hxstar.learn.p_http.model;

import java.util.HashMap;
import java.util.Map;

/**
 * @author huxing
 * @date 2018-12-19 9:43
 */
public final class Header {
    private int crcCode = 0xabef0101;
    private int length;
    private long sessionId;
    private byte type;
    private byte priority;
    private Map<String, Object> attachment = new HashMap<>();

    public Header setSessionId(long sessionId) {
        this.sessionId = sessionId;
        return this;
    }

    @Override
    public String toString() {
        return "{" +
                "\"crcCode\":" + crcCode +
                ",\"length\":" + length +
                ",\"sessionId\":" + sessionId +
                ",\"type\":" + type +
                ",\"priority\":" + priority +
                ",\"attachment\":" + attachment +
                '}';
    }

    public int getCrcCode() {
        return crcCode;
    }

    public Header setCrcCode(int crcCode) {
        this.crcCode = crcCode;
        return this;
    }

    public int getLength() {
        return length;
    }

    public Header setLength(int length) {
        this.length = length;
        return this;
    }

    public Long getSessionId() {
        return sessionId;
    }

    public Header setSessionId(Long sessionId) {
        this.sessionId = sessionId;
        return this;
    }

    public byte getType() {
        return type;
    }

    public Header setType(byte type) {
        this.type = type;
        return this;
    }

    public byte getPriority() {
        return priority;
    }

    public Header setPriority(byte priority) {
        this.priority = priority;
        return this;
    }

    public Map<String, Object> getAttachment() {
        return attachment;
    }

    public Header setAttachment(Map<String, Object> attachment) {
        this.attachment = attachment;
        return this;
    }
}
